Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
@suldashi/lame
Advanced tools
NodeJS native bindings to libmp3lame & libmpg123. Fixed bindings for Node 12
For all your async streaming MP3 encoding/decoding needs, there's node-lame
!
This module hooks into libmp3lame, the library that the lame
command uses, to
provide Encoder
and Decoder
streams to NodeJS.
node-lame
comes bundled with its own copy of libmp3lame
and libmpg123
, so
there's no need to have them installed on your system.
Simply compile and install node-lame
using npm
:
$ npm install lame
Here's an example of using node-lame
to encode some raw PCM data coming from
process.stdin
to an MP3 file that gets piped to process.stdout
:
var lame = require('lame');
// create the Encoder instance
var encoder = new lame.Encoder({
// input
channels: 2, // 2 channels (left and right)
bitDepth: 16, // 16-bit samples
sampleRate: 44100, // 44,100 Hz sample rate
// output
bitRate: 128,
outSampleRate: 22050,
mode: lame.STEREO // STEREO (default), JOINTSTEREO, DUALCHANNEL or MONO
});
// raw PCM data from stdin gets piped into the encoder
process.stdin.pipe(encoder);
// the generated MP3 file gets piped to stdout
encoder.pipe(process.stdout);
See the examples
directory for some more example code.
The Decoder
class is a Stream
subclass that accepts MP3 data written to it,
and outputs raw PCM data. It also emits a "format"
event when the format of
the MP3 file is determined (usually right at the beginning).
The Encoder
class is a Stream
subclass that accepts raw PCM data written to
it, and outputs a valid MP3 file. You must specify the PCM data format when
creating the encoder instance. Only 16-bit signed samples are currently
supported (rescale before passing to the encoder if necessary)...
FAQs
NodeJS native bindings to libmp3lame & libmpg123. Fixed bindings for Node 12
The npm package @suldashi/lame receives a total of 11 weekly downloads. As such, @suldashi/lame popularity was classified as not popular.
We found that @suldashi/lame demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.